<?php

/**
 * @author Rizky Tahara Shita
 * @website http://tahara.web.id
 * @email rizky.tahara@gmail.com
 * @copyright b'IT Cyber Solution
 */

class HRIS_M_command_bar extends BZ_Model
{
/**
 * @section HRIS::Command Bar Model
 * @depedency HRIS_M_live_data
 */

	/**
	 * @function employee_bar
	 * @description generate the employee bar for viewing the employee detail
	 */
	public function employee_bar($prm_employee_list_use = FALSE, $prm_employee_detail_parent_id = '101000001', $prm_view_selected_value = '')
	{
		/**
		 * @description $prm_employee_detail_parent_id values are: 101000001 (personal data) or 101000029 (employee list)
		 */
		if (trim($prm_view_selected_value) != '')
		{
			$prm_view_selected_value = '7;' . $prm_view_selected_value;
		}
		$form_type = array
			(
				(
					($prm_employee_list_use == TRUE)
					? '<b>'.$this->lang->line('hris_employee_data').': </b>'
						. form_dropdown
							(
								'txtinput[0]'
								, array()
								, $prm_view_selected_value
								, 'id="txt0"'
							)
					: ''
				)
				. '&nbsp;<b>'.$this->lang->line('hris_view').': </b>'
				. form_dropdown_group
					(
						'txtinput[1]'
						, $this->M_menu->generate
							(
								'db_default'
								, $this->session->userdata('session_user_id'), 'FALSE', 7
								, FALSE, FALSE, TRUE
								, TRUE, ''
								, FALSE, array(), FALSE
								, $prm_employee_detail_parent_id
								, 'Dropdown'
							)
						, $prm_view_selected_value
						, 'id="txt1"'
					)


				. form_button
					(
						array('id' => 'btn_employee_detail')
						, $this->lang->line('button_search')
					)
			);


		$this->table->clear();
		$table_template = array('table_open' => '<table class = "plain">');
		$this->table->set_template($table_template);

		$form_type = $this->table->make_columns($form_type, 1);
		$return_value = $this->table->generate($form_type);


		return $return_value;
	}


	/**
	 * @function employee_action
	 * @description get and go to the selected menu
	 */
	public function employee_action($prm_menu = '')
	{
		if (trim($prm_menu) != '')
		{
			$menu = explode(';', $prm_menu);
			$menu_rs = $this->db_default->query
				(
					'select `fn_biskitz_menus_get_link`(?, ?) as link'
					, array($menu[0], $menu[1])
				);
			$return_value = site_url($menu_rs->row()->link.'/form/'.$menu[1]);


			return $return_value;
		}
	}



}

/** End of file HRIS_M_command_bar.php */
/** Location: ./biskitz_mpc/biskitz/models/admin/hris/hris_m_command_bar.php */
